object three {
  def main(args:Array[String]):Unit ={

    val students:Array[(String,Int,Int,Int)] = Array(
      ("张三",88,92,85),
      ("李四",75,68,72),
      ("王五",95,90,93),
      ("赵六",58,62,55),
      ("孙七",82,86,88),
    )

    var classTotal: Int = 0
    var passCount: Int = 0
    var excellentCount: Int =0

    for (student <- students){
      val(name,math,chinese,english) = student

      val total: Int = math + chinese + english
      val avg: Double = total.toDouble / 3

      val isPass : Boolean =math >=60 && chinese >=60 && english >=60
      val isExcellent: Boolean = avg >=85

      classTotal += total
      if (isPass) passCount +=1
      if (isExcellent) excellentCount +=1

      println(s"姓名：$name")
      println(s"数学: $math 分, 语文: $chinese 分, 英语: $english 分")
      println(s"总分: $total 分, 平均分: ${"%.1f".format(avg)} 分")
      println(s"是否及格: $isPass, 是否优秀: $isExcellent")
      println("-" * 50) // 分隔线，提升可读性
    }

    // 4. 算术运算符：计算及格率（转换为Double避免整数截断，再转百分比）
    val passRate: Double = (passCount.toDouble / students.length) * 100

    // 输出班级统计结果
    println(s"班级统计结果:")
    println(s"班级总分: $classTotal 分")
    println(s"及格人数: $passCount 人, 优秀人数: $excellentCount 人")
    println(s"班级及格率: ${"%.1f".format(passRate)}%")
  }
}